Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Linux, find the Playdate serial device if possible #38

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

tjkirch
Copy link
Contributor

@tjkirch tjkirch commented Mar 16, 2023

This will use the /dev/serial/by-id/usb-Panic_Inc_Playdate_PDU1-*
symlink to find the appropriate serial device, if possible.  If the
PLAYDATE_SERIAL_DEVICE variable is set, that will take precedence.  If
multiple Playdate devices are found, the user is told, and the first is
used.  If none are found, the same /dev/ttyACM0 backup will be used.

This should eliminate the issue of a new crank user on Linux having to set PLAYDATE_SERIAL_DEVICE and having a bit of trouble getting started. Other devices can use /dev/ttyACM0, like my keyboard, so I ran into this.

Should address the Linux case for #24.

I tested the following cases on Linux:

  • No --run - the simulator ran the game OK.
  • With --run, it found the correct (non-default) device and ran the game OK.
  • If I force the code to fail the sanity check, it gives the expected warning and fails as expected.
  • With my Playdate unplugged, it does as it would before this change: uses the default path and fails as expected.
  • With a manual symlink inserted before the real one, it prints that we're using it, fails the sanity check, then continues with the default path and fails as expected.
  • With a manual symlink inserted after the real one, it prints that we're using it, passes the sanity check, then continues and runs the game OK.

This will use the /dev/serial/by-id/usb-Panic_Inc_Playdate_PDU1-*
symlink to find the appropriate serial device, if possible.  If the
PLAYDATE_SERIAL_DEVICE variable is set, that will take precedence.  If
multiple Playdate devices are found, the user is told, and the first is
used.  If none are found, the same /dev/ttyACM0 backup will be used.
@tjkirch
Copy link
Contributor Author

tjkirch commented Mar 16, 2023

The integration tests failed, only on Mac OS, with a crate fetch error for zip-extensions. The only thing that changed related to that is that there was no newline at the end of Cargo.toml before, and I added a couple lines at the end of the file, so now there's a newline at the end of that line. I've never had anything like that cause a fetch error before, though... I wonder if it would pass on a retry?

@rtsuk
Copy link
Collaborator

rtsuk commented Mar 16, 2023

I tested this PR and it worked fine on Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants